//
//  NavigationViewController.m
//  Chamleon-template
//
//  Created by Fanty on 13-12-19.
//
//

#import "NavigationViewController.h"
#import "UIColor+Extension.h"

@interface NavigationViewController ()

@end

static NavigationViewController *_instance;
@implementation NavigationViewController

+ (instancetype)sharedInstance
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _instance = [[NavigationViewController alloc] init];
    });
    return _instance;
}

+ (instancetype)allocWithZone:(struct _NSZone *)zone
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _instance = [super allocWithZone:zone];
    });
    return _instance;
}
- (id)copyWithZone:(NSZone *)zone
{
    return _instance;
}


- (void)viewDidLoad{
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor whiteColor];
    if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 && [UIDevice currentDevice].userInterfaceIdiom==UIUserInterfaceIdiomPhone){
        
        
        UIView* bgView=[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.view.frame.size.width, 22.0f)];
        bgView.backgroundColor = [UIColor hexStringToColor:@"#4687C7"];
        
        [self.view addSubview:bgView];
        
        self.bgView = bgView;
    }
}


- (void)didReceiveMemoryWarning{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
    if([UIDevice currentDevice].userInterfaceIdiom==UIUserInterfaceIdiomPad)
        return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
    else
        return UIInterfaceOrientationIsPortrait(toInterfaceOrientation);
}

-(BOOL)shouldAutorotate{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations{
    if([UIDevice currentDevice].userInterfaceIdiom==UIUserInterfaceIdiomPad)
        return UIInterfaceOrientationMaskLandscape;
    else
        return UIInterfaceOrientationMaskPortrait;
}


@end
